package com.zhejiangzhengyuan.municipal_common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhejiangzhengyuan.municipal_common.entity.Problems;
import com.zhejiangzhengyuan.municipal_common.entity.vo.ProblemsVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * Mapper 接口
 *
 * @author linju
 * @since 2019-12-12
 */
@Repository
public interface ProblemsMapper extends BaseMapper<Problems> {

  @Update("update problems set geometry=ST_GeomFromText('POINT(${lng} ${lat})') where id=#{id}")
  int updateGeometry(@Param("id") Long id, @Param("lng") String lng, @Param("lat") String lat);

  Page<ProblemsVo> selectVoPage(
      Page<ProblemsVo> voPage,
      @Param("area") String area,
      @Param("projectNum") String projectNum,
      @Param("defectItemCode") String defectItemCode,
      @Param("problemsCode") String problemsCode,
      @Param("startTimestamp") String startTimestamp,
      @Param("endTimestamp") String endTimestamp);

  ProblemsVo getVoById(@Param("id") Long id);

  int selectCountByMonth(@Param("type") String type, @Param("date") String date);

  int selectRectifyCountByMonth(@Param("type") String type, @Param("date") String date);
}
